package TechStuff;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

import Controllers.ControllerCreaterInterfece;

public class ServerStarter extends RmiStarter {
	
	public ServerStarter()
	{
		super(ServerInterface.class);
		doCustomRmiHandling();
	}

	@Override
	public void doCustomRmiHandling() {
		try {
			ServerInterface obj = new Server();
			ServerInterface stub = (ServerInterface) UnicastRemoteObject.exportObject(obj, 0);

		    // Bind the remote object's stub in the registry
		    Registry registry = LocateRegistry.getRegistry();
		    registry.bind(ServerInterface.name, stub);

		    System.err.println(ServerInterface.name + " ready");
		} catch (Exception e) {
		    System.err.println("ClientInterface exception: " + e.toString());
		    e.printStackTrace();
		}	
		
	}

}
